package com.resou.reader.data.gson;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

public class IgnoreExclusionStrategy implements ExclusionStrategy {
    private final Class<?> typeToSkip;

    public IgnoreExclusionStrategy(Class<?> typeToSkip) {
        this.typeToSkip = typeToSkip;
    }

    public boolean shouldSkipClass(Class<?> clazz) {
        return (clazz == typeToSkip);
    }

    public boolean shouldSkipField(FieldAttributes f) {
        return f.getAnnotation(Ignore.class) != null;
    }
}
